﻿/* Write a program to convert decimal numbers to their hexadecimal representation. */
using System;
using System.Collections.Generic;

class DecimalToHex
{
    static void Main()
    {
        //proverka dali e chislo
        //proverka dali e int
        //implementirane na otricatelno chislo
        Console.WriteLine("Please enter decimal number");
        int decimalNumber = int.Parse(Console.ReadLine());
        List<string> result = new List<string>();
        while (decimalNumber != 0)
        {
            int hexNumber = decimalNumber % 16;
            string hex;
            if (hexNumber == 10)
            {
                hex = "A";
            }
            else if (hexNumber == 11)
            {
                hex = "B";
            }
            else if (hexNumber == 12)
            {
                hex = "C";
            }
            else if (hexNumber == 13)
            {
                hex = "D";
            }
            else if (hexNumber == 14)
            {
                hex = "E";
            }
            else if (hexNumber == 15)
            {
                hex = "F";
            }
            else
            {
                hex = hexNumber.ToString();
            }       
            result.Add(hex);
            decimalNumber /= 16;
        }

        Console.WriteLine("The hex number is: ");
        for (int i = result.Count-1; i >= 0; i--)
        {
            Console.Write(result[i]);
        }

        Console.WriteLine();
    }
}
